<html>
<head>
<title>Project Added</title>
<link rel="stylesheet" href="css/general.css" type="text/css"/>
</head>
<body>
<?php

//Obtiene las variables
$name = $_POST['project_name'];
$trig_question = $_POST['trig_question'];
$number_elements = $_POST['number_elements'];
$element_type = $_POST['element_type'];

//Database connection
$dbc = mysqli_connect('localhost','root','','ism')
	or die("Unable to connect to MySQL");

//Inserta valores de proyectos
$sql = "INSERT INTO project VALUES('','$name', '$trig_question', '$number_elements', '$element_type')"; 
$result = mysqli_query($dbc, $sql)
	or die('Query failed!');
//Imprime los valores introducidos
echo('The project has been added with the following information:<br>
Project Name:'.$name.'<br> Triggering Question:'.$trig_question.'<br>
Number of elements:'.$number_elements.'<br>');
$id = mysqli_insert_id($dbc);
//Pasa a element/add.php con el id del proyecto
echo ('<p><a href="../element/add.php?project_id='.$id.'&element_index=0">Start element definition</a>');
?>

</body>
</html>